Skip to content

Conversation

@johnsoncodehk
Copy link
Member

@johnsoncodehk johnsoncodehk commented Mar 23, 2024

Try to reduce the abstraction of core parts as much as possible, and use more precise terminology.

language-core uses the term "Script" instead of "File", because "File" implies dependence on the File System and "Script" semantics are looser.

language-core

  • Renamed SourceFile interface to SourceScript
  • LanguageContext interface and FileRegistry interface are merged into Language interface
  • Removed FileRegistry.getVirtualCode API, now you should use:
     Language.scripts.get(scriptId).generated.embeddedCodes.get(virtualCodeId)

language-service

  • Renamed ServicePlugin interface to LanguageServicePlugin
  • Renamed Result interface to ProviderResult
  • Renamed LanguagePlugin.typescript's getScript hook to getServiceScript
  • Renamed LanguagePlugin.typescript's getExtraScripts hook to getExtraServiceScripts
  • Removed ServiceContext.documents.getVirtualCodeByUri, now you should use:
     const decoded = context.decodeEmbeddedDocumentUri(documentUri);
     const sourceScript = decoded && context.language.scripts.get(decoded[0]);
     const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
  • Removed ServiceContext.documents.getVirtualCodeUri, now you should use:
     context.encodeEmbeddedDocumentUri(documentUri, virtualCodeId);

@johnsoncodehk johnsoncodehk changed the title refactor: adjust abstraction refactor: more accurate interfaces Mar 23, 2024
@johnsoncodehk johnsoncodehk changed the title refactor: more accurate interfaces refactor: more accurate interface design and terminology Mar 23, 2024
@johnsoncodehk johnsoncodehk merged commit 69f697e into 2.2 Mar 23, 2024
@johnsoncodehk johnsoncodehk deleted the 2.2-types branch March 23, 2024 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants